﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Lib.CommonForm;
using System.Data.SqlClient;

namespace AUI
{
    public partial class Form1 : FormBase
    {
        public Form1(string formText)
        {
            InitializeComponent();

            Init_Form();
            toolStrip2.BackColor = this.BackColor;
            this.Text = formText;

            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("Customer_ID", 5);

            /* Cach 1 */
            //dataGridView1.DataSource = DataConnect.ExecuteTable_Dic("select * from CMS_Customer where Customer_ID = @Customer_ID", d);


            /* cach 2 */
            //dataGridView1.DataSource = DataConnect.ExecuteTable("select * from CMS_Customer where Customer_ID = 5", null);

            /* cach 3 */
            //dataGridView1.DataSource = DataConnect.ExecuteTable("CMS_Customer_GetInfo", 5);


            /* cach 4 */
            //dataGridView1.DataSource = DataConnect.ExecuteTable_Dic("CMS_Customer_GetInfo", d);


            //GetAll
            //dataGridView1.DataSource = DataConnect.ExecuteTable("CMS_Customer_GetAll", null);

            //SqlDataReader reader = DataConnect.ExecuteReader("CMS_Customer_GetInfo", 5);
            //while (reader.Read())
            //{
            //     MessageBox.Show (String.Format("{0}", reader[0]));
            //}


            //Dùng service
            dataGridView1.DataSource = DataConnect.ExecuteDataset("Ibms_Branch_getone", 1).Tables[0];

        }
    }
}
